
import Vue from 'vue'
import Router from 'vue-router'
import Home from  '../components/Home'
import Login from  '../components/Login'
import NoAuth from '../components/NoAuth'
import SysUser from '../components/sys/SysUser'
import SysRole from '../components/sys/SysRole'
import SysAuth from '../components/sys/SysAuth'
import SysLog from "../components/sys/SysLog";
import ShowInvoice from "../components/finance/ShowInvoice";
import AddInvoice from "../components/finance/AddInvoice";
import ShowStatement from "../components/finance/ShowStatement"
import CarInfo from "../components/car/CarInfo";
import FinStatement from "../components/finance/FinStatement";
import FinInvoice from "../components/finance/FinInvoice";
import AddStatement from "../components/finance/AddStatement";
import BillboardAll from "../components/billboard/BillboardAll";
import CarDetail from "../components/car/CarDetail";
import DispatchTicket from "../components/dispatch/DispatchTicket";
import DispatchAdd from "../components/dispatch/DispatchAdd";
import Customer from "../components/base/Customer";
import Driver from "../components/base/Driver";
import Map1 from '../components/statistics/AbnormalStatistics'
import OrderOperate from "../components/order/OrderOperate";
import OrderForm from "../components/order/OrderForm";
import DispatchAbnormalRecord from '../components/dispatch/DispatchAbnormalRecord'
import DispatchMaintenance from '../components/dispatch/DispatchMaintenance'
import DispatchDelayRecord from '../components/dispatch/DispatchDelayRecord'
import DispatchTransportationTrack from "../components/dispatch/DispatchTransportationTrack";
import DispatchTrackTracking from "../components/dispatch/DispatchTrackTracking";
import DispatchTrackDetail from "../components/dispatch/DispatchTrackDetail";
import DispatchNodeTracking from "../components/dispatch/DispatchNodeTracking";
import CarBusiness from "../components/car/CarBusiness";
import DispatchOrderStatistics from "../components/statistics/DispatchOrderStatistics";
import BillboardCarUseRate from "../components/billboard/BillboardCarUseRate";
import DispatchEdit from "../components/dispatch/DispatchEdit";
import FreightBillStatistics from "../components/statistics/FreightBillStatistics ";
import DijkstraShortPath from '../components/IntelligentDispatch/DijkstraShortPath'
import DispatchDetail from "../components/dispatch/DispatchDetail";
import TransitPath from "../components/IntelligentDispatch/TransitPath";

import DispatchingStatistics from "../components/statistics/DispatchingStatistics";


Vue.use(Router)

//解决路由重复跳转报错
const VueRouterPush = Router.prototype.push
Router.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/Login'
    },
    {
      path: '/Login',
      name: 'Login',
      component: Login
    },
    {
      path: '/Home',
      name: 'Home',
      meta:{index:0},//meta对象的index用来定义当前路由的层级,由小到大,由低到高
      component: Home,
      children: [
        {
          path: '/DispatchingStatistics',
          name: 'DispatchingStatistics',
          component: DispatchingStatistics
        },
        {
          path: '/DispatchOrderStatistics',
          name: 'DispatchOrderStatistics',
          component: DispatchOrderStatistics
        },
        {
          path: '/DispatchTransportationTrack',
          name: 'DispatchTransportationTrack',
          component: DispatchTransportationTrack
        },
        {
          path: '/DispatchNodeTracking',
          name: 'DispatchNodeTracking',
          component: DispatchNodeTracking
        },
        {
          path: '/DispatchTrackDetail',
          name: 'DispatchTrackDetail',
          component: DispatchTrackDetail
        },
        {
          path: '/DispatchTrackTracking',
          name: 'DispatchTrackTracking',
          component: DispatchTrackTracking
        },
        {
          path: '/CarBusiness',
          name: 'CarBusiness',
          component: CarBusiness
        },
        {
          path: '/OrderOperate',
          name: 'OrderOperate',
          meta:{index:1},
          component: OrderOperate
        },
        {
          path: '/CarBusiness',
          name: 'CarBusiness',
          meta:{index:1},
          component: CarBusiness
        },

        {
          path: '/OrderForm',
          name: 'OrderForm',
          meta:{index:1},
          component: OrderForm
        },
        {
          path: '/NoAuth',
          name: 'NoAuth',
          meta:{index:1},
          component: NoAuth
        },
        {
          path: '/SysUser',
          name: 'SysUser',
          meta:{index:1},
          component: SysUser
        },
        {
          path: '/SysRole',
          name: 'SysRole',
          meta:{index:1},
          component: SysRole
        },
        {
          path: '/SysAuth',
          name: 'SysAuth',
          meta:{index:1},
          component: SysAuth
        },
        {
          path: '/SysLog',
          name: 'SysLog',
          meta:{index:1},
          component: SysLog
        },
        {
          path: '/FinStatement',
          name: 'FinStatement',
          meta:{index:1},
          component: FinStatement
        },
        {
          path: '/AddStatement',
          name: 'AddStatement',
          meta:{index:1},
          component: AddStatement
        },
        {
          path: '/ShowStatement',
          name: 'ShowStatement',
          component: ShowStatement
        },
        {
          path: '/FinInvoice',
          name: 'FinInvoice',
          meta:{index:1},
          component: FinInvoice
        },
        {
          path: '/AddInvoice',
          name: 'AddInvoice',
          meta:{index:1},
          component: AddInvoice
        },
        {
          path: '/ShowInvoice',
          name: 'ShowInvoice',
          meta:{index:1},
          component: ShowInvoice
        },
        {
          path: '/Customer',
          name: 'Customer',
          meta:{index:1},
          component: Customer
        },
        {
          path: '/Driver',
          name: 'Driver',
          meta:{index:1},
          component: Driver
        },
        {
          path: '/CarInfo',
          name: 'CarInfo',
          component: CarInfo
        },
        {
          path: '/Map1',
          name: 'Map1',
          meta:{index:1},
          component: Map1
        },
        {
          path: '/DispatchAbnormalRecord',
          name: 'DispatchAbnormalRecord',
          meta:{index:1},
          component: DispatchAbnormalRecord

        },
        {
          path: '/DispatchDelayRecord',
          name: 'DispatchDelayRecord',
          component: DispatchDelayRecord
        },
        {
          path: '/DispatchMaintenance',
          name: 'DispatchMaintenance',
          component: DispatchMaintenance
        },
        {
          path: '/CarDetail',
          name: 'CarDetail',
          meta:{index:1},
          component: CarDetail

        },
        {
          path: '/DispatchTicket',
          name: 'DispatchTicket',
          meta:{index:1},
          component: DispatchTicket,
        },
        {
          path: '/DispatchAdd',
          name: 'DispatchAdd',
          meta:{index:1},
          component: DispatchAdd
        },
        {
          path: '/DispatchEdit',
          name: 'DispatchEdit',
          meta:{index:1},
          component: DispatchEdit
        },
        {
          path: '/DispatchDetail',
          name: 'DispatchDetail',
          meta:{index:1},
          component: DispatchDetail
        },
        {
          path: '/BillboardAll',
          name: 'BillboardAll',
          meta:{index:1},
          component: BillboardAll,
          children:[
            {
              path: '/BillboardCarUseRate',
              name: 'BillboardCarUseRate',
              meta:{index:2},
              component: BillboardCarUseRate
            }
          ]
        },
        {
          path: '/OrderForm',
          name: 'OrderForm',
          meta:{index:1},
          component: OrderForm
        },

        {
          path: '/OrderOperate',
          name: 'OrderOperate',
          meta:{index:1},
          component: OrderOperate
        },

        {
          path: '/DijkstraShortPath',
          name: 'DijkstraShortPath',
          component: DijkstraShortPath

        },
        {
          path: '/TransitPath',
          name: 'TransitPath',
          component: TransitPath
        },


      ]
    }
  ]
})
